Optimal. Leaf size=107 \[ \frac {2 (5 A-2 B) \tan (c+d x)}{3 a^2 d}-\frac {(2 A-B) \tanh ^{-1}(\sin (c+d x))}{a^2 d}-\frac {(2 A-B) \tan (c+d x)}{a^2 d (\cos (c+d x)+1)}-\frac {(A-B) \tan (c+d x)}{3 d (a \cos (c+d x)+a)^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.30, antiderivative size = 107, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.161, Rules used = {2978, 2748, 3767, 8, 3770} \[ \frac {2 (5 A-2 B) \tan (c+d x)}{3 a^2 d}-\frac {(2 A-B) \tanh ^{-1}(\sin (c+d x))}{a^2 d}-\frac {(2 A-B) \tan (c+d x)}{a^2 d (\cos (c+d x)+1)}-\frac {(A-B) \tan (c+d x)}{3 d (a \cos (c+d x)+a)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 2748
Rule 2978
Rule 3767
Rule 3770
Rubi steps
\begin {align*} \int \frac {(A+B \cos (c+d x)) \sec ^2(c+d x)}{(a+a \cos (c+d x))^2} \, dx &=-\frac {(A-B) \tan (c+d x)}{3 d (a+a \cos (c+d x))^2}+\frac {\int \frac {(a (4 A-B)-2 a (A-B) \cos (c+d x)) \sec ^2(c+d x)}{a+a \cos (c+d x)} \, dx}{3 a^2}\\ &=-\frac {(2 A-B) \tan (c+d x)}{a^2 d (1+\cos (c+d x))}-\frac {(A-B) \tan (c+d x)}{3 d (a+a \cos (c+d x))^2}+\frac {\int \left (2 a^2 (5 A-2 B)-3 a^2 (2 A-B) \cos (c+d x)\right ) \sec ^2(c+d x) \, dx}{3 a^4}\\ &=-\frac {(2 A-B) \tan (c+d x)}{a^2 d (1+\cos (c+d x))}-\frac {(A-B) \tan (c+d x)}{3 d (a+a \cos (c+d x))^2}+\frac {(2 (5 A-2 B)) \int \sec ^2(c+d x) \, dx}{3 a^2}-\frac {(2 A-B) \int \sec (c+d x) \, dx}{a^2}\\ &=-\frac {(2 A-B) \tanh ^{-1}(\sin (c+d x))}{a^2 d}-\frac {(2 A-B) \tan (c+d x)}{a^2 d (1+\cos (c+d x))}-\frac {(A-B) \tan (c+d x)}{3 d (a+a \cos (c+d x))^2}-\frac {(2 (5 A-2 B)) \operatorname {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{3 a^2 d}\\ &=-\frac {(2 A-B) \tanh ^{-1}(\sin (c+d x))}{a^2 d}+\frac {2 (5 A-2 B) \tan (c+d x)}{3 a^2 d}-\frac {(2 A-B) \tan (c+d x)}{a^2 d (1+\cos (c+d x))}-\frac {(A-B) \tan (c+d x)}{3 d (a+a \cos (c+d x))^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 1.85, size = 264, normalized size = 2.47 \[ \frac {2 \cos \left (\frac {1}{2} (c+d x)\right ) \left ((A-B) \tan \left (\frac {c}{2}\right ) \cos \left (\frac {1}{2} (c+d x)\right )+(A-B) \sec \left (\frac {c}{2}\right ) \sin \left (\frac {d x}{2}\right )+6 \cos ^3\left (\frac {1}{2} (c+d x)\right ) \left ((2 A-B) \left (\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\sin \left (\frac {1}{2} (c+d x)\right )+\cos \left (\frac {1}{2} (c+d x)\right )\right )\right )+\frac {A \sin (d x)}{\left (\cos \left (\frac {c}{2}\right )-\sin \left (\frac {c}{2}\right )\right ) \left (\sin \left (\frac {c}{2}\right )+\cos \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right ) \left (\sin \left (\frac {1}{2} (c+d x)\right )+\cos \left (\frac {1}{2} (c+d x)\right )\right )}\right )+2 (7 A-4 B) \sec \left (\frac {c}{2}\right ) \sin \left (\frac {d x}{2}\right ) \cos ^2\left (\frac {1}{2} (c+d x)\right )\right )}{3 a^2 d (\cos (c+d x)+1)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 0.75, size = 207, normalized size = 1.93 \[ -\frac {3 \, {\left ({\left (2 \, A - B\right )} \cos \left (d x + c\right )^{3} + 2 \, {\left (2 \, A - B\right )} \cos \left (d x + c\right )^{2} + {\left (2 \, A - B\right )} \cos \left (d x + c\right )\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left ({\left (2 \, A - B\right )} \cos \left (d x + c\right )^{3} + 2 \, {\left (2 \, A - B\right )} \cos \left (d x + c\right )^{2} + {\left (2 \, A - B\right )} \cos \left (d x + c\right )\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (2 \, {\left (5 \, A - 2 \, B\right )} \cos \left (d x + c\right )^{2} + {\left (14 \, A - 5 \, B\right )} \cos \left (d x + c\right ) + 3 \, A\right )} \sin \left (d x + c\right )}{6 \, {\left (a^{2} d \cos \left (d x + c\right )^{3} + 2 \, a^{2} d \cos \left (d x + c\right )^{2} + a^{2} d \cos \left (d x + c\right )\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.45, size = 155, normalized size = 1.45 \[ -\frac {\frac {6 \, {\left (2 \, A - B\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a^{2}} - \frac {6 \, {\left (2 \, A - B\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a^{2}} + \frac {12 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )} a^{2}} - \frac {A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 15 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 9 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{6}}}{6 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.15, size = 205, normalized size = 1.92 \[ \frac {\left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) A}{6 d \,a^{2}}-\frac {B \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d \,a^{2}}+\frac {5 A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 d \,a^{2}}-\frac {3 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 d \,a^{2}}+\frac {2 A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d \,a^{2}}-\frac {\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) B}{d \,a^{2}}-\frac {A}{d \,a^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}-\frac {2 A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d \,a^{2}}+\frac {\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) B}{d \,a^{2}}-\frac {A}{d \,a^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [B] time = 0.53, size = 244, normalized size = 2.28 \[ \frac {A {\left (\frac {\frac {15 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac {12 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a^{2}} + \frac {12 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a^{2}} + \frac {12 \, \sin \left (d x + c\right )}{{\left (a^{2} - \frac {a^{2} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}\right )} {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} - B {\left (\frac {\frac {9 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac {6 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a^{2}} + \frac {6 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a^{2}}\right )}}{6 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 0.28, size = 123, normalized size = 1.15 \[ \frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {A-B}{a^2}+\frac {3\,A-B}{2\,a^2}\right )}{d}+\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (A-B\right )}{6\,a^2\,d}-\frac {2\,A\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-a^2\right )}-\frac {2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (2\,A-B\right )}{a^2\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ \frac {\int \frac {A \sec ^{2}{\left (c + d x \right )}}{\cos ^{2}{\left (c + d x \right )} + 2 \cos {\left (c + d x \right )} + 1}\, dx + \int \frac {B \cos {\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}}{\cos ^{2}{\left (c + d x \right )} + 2 \cos {\left (c + d x \right )} + 1}\, dx}{a^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________